/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package isd.inventario.vistas;

import isd.inventario.modelo.ST_Deposito;
import isd.inventario.modelo.ST_Producto;
import isd.inventario.modelo.ST_Sector;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author Claudio
 */
@Entity
@Table(name = "st_stockdepo")
@IdClass(ST_StockProductoDepositoPK.class)
public class ST_StockProductoDeposito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Column(name = "STRMVK_TIPPRO", nullable = false, length = 6)
    private String tippro;
    @Id
    @Column(name = "STRMVK_ARTCOD", nullable = false, length = 30)
    private String artcod;
    @Id
    @Column(name = "STRMVK_DEPOSI", nullable = false, length = 15)
    private String codigoDeposito;
    @Id
    @Column(name = "STRMVK_SECTOR", nullable = false, length = 15)
    private String codigoSector;

    @JoinColumns({
    @JoinColumn(name = "STRMVK_TIPPRO", referencedColumnName = "STMPDH_TIPPRO", nullable = false,insertable=false, updatable=false),
    @JoinColumn(name = "STRMVK_ARTCOD", referencedColumnName = "STMPDH_ARTCOD", nullable = false,insertable=false, updatable=false)
    })
    @ManyToOne(optional=false)
    private ST_Producto producto;

    /**
     * Deposito egreso
     */
    @JoinColumn(name = "STRMVK_DEPOSI", referencedColumnName = "STTDEH_DEPOSI",insertable=false, updatable=false)
    @ManyToOne(optional=false)
    private ST_Deposito deposito;

    /**
     * Sector egreso
     */
    @JoinColumns({
        @JoinColumn(name = "STRMVK_DEPOSI", referencedColumnName = "STTDEI_DEPOSI", nullable = false,insertable=false, updatable=false),
        @JoinColumn(name = "STRMVK_SECTOR", referencedColumnName = "STTDEI_SECTOR", nullable = false,insertable=false, updatable=false)
    })
    @ManyToOne
    private ST_Sector sector;

    @Column(name = "STRMVK_STOCKS", precision = 40, scale = 4)
    private BigDecimal stock;

    public ST_StockProductoDeposito() {
    }

    public String getArtcod() {
        return artcod;
    }

    public void setArtcod(String artcod) {
        this.artcod = artcod;
    }

    public String getCodigoDeposito() {
        return codigoDeposito;
    }

    public void setCodigoDeposito(String codigoDeposito) {
        this.codigoDeposito = codigoDeposito;
    }

    public String getCodigoSector() {
        return codigoSector;
    }

    public void setCodigoSector(String codigoSector) {
        this.codigoSector = codigoSector;
    }

    public ST_Deposito getDeposito() {
        return deposito;
    }

    public void setDeposito(ST_Deposito deposito) {
        this.deposito = deposito;
    }

    public ST_Producto getProducto() {
        return producto;
    }

    public void setProducto(ST_Producto producto) {
        this.producto = producto;
    }

    public ST_Sector getSector() {
        return sector;
    }

    public void setSector(ST_Sector sector) {
        this.sector = sector;
    }
    
    public BigDecimal getStock() {
        return stock;
    }

    public void setStock(BigDecimal stock) {
        this.stock = stock;
    }

    public String getTippro() {
        return tippro;
    }

    public void setTippro(String tippro) {
        this.tippro = tippro;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ST_StockProductoDeposito other = (ST_StockProductoDeposito) obj;
        if ((this.tippro == null) ? (other.tippro != null) : !this.tippro.equals(other.tippro)) {
            return false;
        }
        if ((this.artcod == null) ? (other.artcod != null) : !this.artcod.equals(other.artcod)) {
            return false;
        }
        if ((this.codigoDeposito == null) ? (other.codigoDeposito != null) : !this.codigoDeposito.equals(other.codigoDeposito)) {
            return false;
        }
        if ((this.codigoSector == null) ? (other.codigoSector != null) : !this.codigoSector.equals(other.codigoSector)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 61 * hash + (this.tippro != null ? this.tippro.hashCode() : 0);
        hash = 61 * hash + (this.artcod != null ? this.artcod.hashCode() : 0);
        hash = 61 * hash + (this.codigoDeposito != null ? this.codigoDeposito.hashCode() : 0);
        hash = 61 * hash + (this.codigoSector != null ? this.codigoSector.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "ST_StockProductoDeposito{" + "tippro=" + tippro + "artcod=" + artcod + "deposi=" + codigoDeposito + "sector=" + codigoSector + '}';
    }

    

}
